package main
import(
	"fmt"
	//"strconv"
)
const N int = 99

func main() {
	largest := 0
	for i := 1; i < 1000; i++ {
		for k := 1; k < 1000; k++ {
			p := i*k
			if isPalindrome(p) {
				if p > largest {
					largest = p
				}
			}
		}
	}
	//fmt.Printf("is %v palindrome? %v\n", N, isPalindrome(N))
	fmt.Printf("Largest palindrome of 3 digits is: %v\n", largest)
}

func isPalindrome(x int) bool {
	x_copy := x
	//n := x
	rev := 0
	for x  != 0 {
		n := x % 10
		rev = rev *10 + n
		x = x / 10
	}
	if rev == x_copy {
		return true
	}
	return false
}
